package DAO;

import Bean.OrderItem;


import java.util.List;

/**
 * @author jianjun
 * @Describe
 * @creat 2022-01-01-17:21
 */
public class OrderItemDAOImpl extends BaseDAO implements OrderItemDAO {
    @Override
    public int saveOrderItem(OrderItem orderItem) {
        String sql = "insert into t_order_item(`name`,`price`,`total_money`,`count`,`order_id`) value(?,?,?,?,?)";
        return updata(sql, orderItem.getName(), orderItem.getPrice(), orderItem.getTotal_money(), orderItem.getCount(), orderItem.getOrder_id());
    }

    @Override
    public List<OrderItem> queryOrderItemsByOrderId(String order_id) {
        String sql = "select * from t_order_item where order_id = ?";
        return queryForList(OrderItem.class,sql,order_id);
    }
}
